<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>滑入滑出动画效果</title>
  <style>
    .box{
      width: 300px;
      height: 300px;
      background-color: rgb(115, 32, 223);
      margin: 50px auto;
    }
  </style>
</head>
<script src="js/jquery-1.12.4.min.js"></script>
<script>
$(function(){
  $('.btn1').click(function () {
    $('.box').slideDown(500, function () {
      alert('下滑显示完成!!!');
    });
  });

  $('.btn2').click(function () {
    $('.box').slideUp(500, function () {
      alert('上滑隐藏完成!!!');
    });
  });

  $('.btn3').click(function(){
    $('.box').slideToggle(1000,function(){
      alert('切换完成!!!');
    });
  });
});
</script>
<body>
  <button class="btn1">显示</button>
  <button class="btn2">隐藏</button>
  <button class="btn3">滑动切换</button>
  <div class="box"></div>
</body>
</html>